package com.illtamer.infinite.sillage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.illtamer.infinite.sillage.pojo.Blog;
import com.illtamer.infinite.sillage.vo.BlogQuery;
import com.illtamer.infinite.sillage.vo.HomeBlog;
import com.illtamer.infinite.sillage.vo.MinBlog;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Mapper
public interface BlogMapper extends BaseMapper<Blog> {

    Boolean insertBlog(@Param("blog") Blog blog);

    Boolean updateBlog(@Param("blog") Blog blog);

    Boolean updateViews(@Param("count") Long count, @Param("blogId") Integer blogId);

    Page<Blog> listBlogs(@Param("page") Page<Blog> page, @Param("blogQuery") BlogQuery blogQuery);

    List<Blog> listBlogByUserId(@Param("id") Integer id);

    Page<HomeBlog> listRecommendHomeBlog(@Param("page") Page<HomeBlog> page);

    Page<HomeBlog> listHomeBlogByTypeId(@Param("page") Page<Object> page, @Param("typeId") Integer typeId);

    Page<MinBlog> listLatestMinBlog(@Param("page") Page<MinBlog> page);

    Page<HomeBlog> searchHomeBlog(@Param("page") Page<Object> page, @Param("content") String content);

    List<String> listYear();

    List<MinBlog> listMinBlogByYear(@Param("year") String year);

}
